<template>
  <div class="product_list">
    名称:{{data.name}}<br/>
    市场价:{{data.marketPrice}}<br/>
    现价:{{data.price}}<br/>

  </div>
</template>

<script>

export default {
  name: "ProductDetail",
  props: ["id"],
  data() {
    return {data: {}};
  },
  mounted() {
    this.loadData();
  },
  methods: {
    //加载产品数据
    loadData() {
      const loading = this.$loading({
        target: ".product_list",
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      this.axios({
        url: "management/product/get_by_id",
        method: "POST",
        data: this.$qs.stringify({id: this.id}),
        headers: {"Content-Type": "application/x-www-form-urlencoded;chartset=utf-8"}
      }).then(resp => {
        this.data = resp.data.data
        this.$forceUpdate();
        loading.close();
      }).catch(function (resp) {
        loading.close();
      })
    }
  }
}
</script>

<style scoped>

</style>
